#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
function chekck(){
    ctime=`date "+%Y-%m-%d %H:%M:%S"`
    process_Key=$1
    echo $0
    pids=`ps -ef | grep "${process_Key}" | grep -v grep | awk '{print $2}'`
    if [ "${pids}" = "" ] #查找的进程未启动
    then
        cd /www/wwwroot/xuniji
        /www/server/php/72/bin/php think "${process_Key}"
        echo "START ${process_Key} SUCCESS"
    else
        echo " ${process_Key} PROCESSOR IS RUNNING"
    fi
  
}

NAME[0]="swoole1"
NAME[1]="swoole2"
NAME[2]="swoole3"

for (( i = 0; i < 3; i++ ));
do
    chekck ${NAME[i]}
done

